package com.growthsee.rider.wrapper;

import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.growthsee.rider.domain.RiderInfo;
import com.growthsee.rider.service.RiderInfoService;
import com.growthsee.rider.utils.ApplicationContexts;

public class CommonWrapper {
    public static CommonWrapper builder() {
        return new CommonWrapper();
    }

    public String verifyPhone(String phone) {
        RiderInfoService riderInfoService = ApplicationContexts.getBean(RiderInfoService.class);
        RiderInfo riderInfo = riderInfoService.getOne(Wrappers.<RiderInfo>lambdaQuery().eq(RiderInfo::getMobilePhone, phone));
        if (ObjectUtils.isNotEmpty(riderInfo)) return "该手机号已经注册";
        return "";
    }
}
